/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.hauntedhouses.service.impl;

import cz.muni.fi.hauntedhouses.dao.AuthoritiesDAO;
import cz.muni.fi.hauntedhouses.dao.UsersDAO;
import cz.muni.fi.hauntedhouses.service.AuthoritiesService;
import cz.muni.fi.hauntedhouses.to.AuthoritiesTO;
import cz.muni.fi.hauntedhouses.to.UsersTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author honzaq
 */
@Service
@Transactional
public class AuthoritiesServiceImpl implements AuthoritiesService {
    
    @Autowired
    private AuthoritiesDAO authoritiesDao;
    
    @Override
    public void create(AuthoritiesTO role) {
            authoritiesDao.create(role);
    }

    @Override
    public AuthoritiesTO get(Long id) {
        return authoritiesDao.get(id);
    }

    @Override
    @Secured({"ROLE_ADMIN"})
    public void remove(AuthoritiesTO role) {
        authoritiesDao.delete(role);
    }

    @Override
    @Secured({"ROLE_ADMIN"})
    public void update(AuthoritiesTO role) {
        authoritiesDao.update(role);
    }
    
}
